<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html class="x-admin-sm">

	<head>
		<meta charset="UTF-8">
		<title>车辆信息查询</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="HouTaiCss/css/font.css">
		<link rel="stylesheet" href="HouTaiCss/css/xadmin.css">
		<script src="HouTaiCss/lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="HouTaiCss/js/xadmin.js"></script>
		<!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
	</head>
 
	<body>
		<div class="x-nav">
			<span class="layui-breadcrumb">
                <a href="http://localhost/JCP_PL/index.jsp">首页</a>
                <a >用户管理</a>
                <a>
                    <cite>车辆信息查询</cite></a>
            </span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
				<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
			</a>
		</div>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body ">
							<form class="layui-form layui-col-space5" >
								<div class="layui-inline layui-show-xs-block">
									<input type="text" name="carNumber" placeholder="车牌号" autocomplete="off" class="layui-input"></div>
								<div class="layui-inline layui-show-xs-block">
									<button class="layui-btn" data-type="" lay-submit="" lay-filter="find">
                                        <i class="layui-icon">&#xe615;</i></button>
								</div>
							</form>
						</div>
						<div class="layui-card-body ">
							<table class="layui-table" lay-data="{url:'selCarMessage',page:true,toolbar: '#toolbarDemo',id:'tableData1'}" id="tableData1" lay-filter="tableData1">
								<thead>
									<tr>
										<th lay-data="{type:'checkbox'}">ID</th>
										<th lay-data="{field:'carNumber', width:120, sort: true}">车牌号</th>
										<th lay-data="{field:'userName', width:120, sort: true}">车主姓名</th>
										<th lay-data="{field:'phoneNumber', minWidth: 150}">联系方式</th>
										<th lay-data="{field:'carModel', sort: true}">车辆型号</th>
										<th lay-data="{field:'carColor', sort: true }">车辆颜色</th>
									</tr>
								</thead>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/html" id="toolbarDemo">
		<div class="layui-btn-container">
			<button class="layui-btn layui-btn-sm" lay-event="getCheckData"> 禁用 </button>
			<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button > 
		</div> 
	</script>
	<!--<script type="text/html" id="switchTpl">
		<!-- 这里的checked的状态只是演示 -->
		<!--<input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id==1 0003 ? 'checked': ''}}>-->
	<!--</script>-->
	

	<script>
		layui.use(['form','table','laydate'], function(){
			var form = layui.form,
				table = layui.table,
				laydate = layui.laydate;
			
			//执行一个laydate实例
			laydate.render({
				elem: '#start' //指定元素
			});

			//执行一个laydate实例
			laydate.render({
				elem: '#end' //指定元素
			});
			
			//监听单元格编辑
			table.on('edit(tableData1)',
				function(obj) {
					var value = obj.value //得到修改后的值
						,
						data = obj.data //得到所在行所有键值
						,
						field = obj.field; //得到字段
					 /* 编辑单元格   ajax响应 */
						  $.ajax({
								type:"post",
								url:"${pageContext.request.contextPath}/..",
							     data:{
							    	 op:'upd',
							    	 id:data.id,
							    	 title:data.title,
							    	 content:data.content,
							    	 state:data.state
							     },
								success:function (msg) {
									if(msg)
									{
										layer.msg("修改成功",{icon:1})}
									else{
										
										layer.msg("修改失败",{icon:2})
									}
									
								}
							});
					
				});
			//头工具栏事件
			table.on('toolbar(tableData1)',
				function(obj) {
					var checkStatus = table.checkStatus(obj.config.id);
					switch(obj.event) {
						case 'getCheckData':
							var id = checkStatus.data[0].id;
							$.ajax({
								type:"post",
								url:"${pageContext.request.contextPath}/ArticleServlet",
							     data:{
							    	 op:'RecAndBan',
							    	 id:id,
							    	 state:'1'
							     },
								success:function (msg) {
									layer.msg(data?"修改成功":"修改失败",{icon:1,time:20000})
									parent.location.reload();
									
								}
							});
							break;
						case 'getCheckLength':
							var data = checkStatus.data;
							layer.msg('选中了：' + data.length + ' 个');
							break;
						case 'isAll':
							layer.msg(checkStatus.isAll ? '全选' : '未全选');
							break;
					};
				});
			//监听提交
			  form.on('submit(find)', function(data){
					var obj = data.field;
							 table.reload('tableData1',{
								 where:{
									 carNumber : obj.carNumber,
										start : obj.start,
										end: obj.end
								 }
							 }); 
		
				
				  return false
				 
			  });
		});

	</script>

</html>